package com.neusoft.my12306.controller;


import com.neusoft.my12306.common.res.CommonResult;
import com.neusoft.my12306.entity.Ticket;
import com.neusoft.my12306.service.IScheduleService;
import com.neusoft.my12306.service.ITicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 葛彬
 * @since 2023-07-20
 */
@CrossOrigin
@RestController
@RequestMapping("/ticket")
public class TicketController {


    @Autowired
    ITicketService ticketService;

    @PostMapping("/query")
    public CommonResult querySeatnum(@RequestBody Ticket ticket,@RequestParam String fromSt,@RequestParam String toSt) {
        return ticketService.querySeatnum(ticket,fromSt,toSt);
    }

    @PostMapping("/queryseat")
    public CommonResult querySeat(@RequestBody Ticket ticket) {
        return ticketService.querySeat(ticket);
    }

    @PostMapping("/insertseat")
    public CommonResult insertSeat(@RequestBody Ticket ticket) {
        return ticketService.insertSeat(ticket);
    }

    @PostMapping("/delseat")
    public CommonResult delSeat(@RequestBody Ticket ticket) {
        return ticketService.delSeat(ticket);
    }

}
